package com.todo.user.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/4/8 10:14
 * @description
 */
@Getter
@AllArgsConstructor
public enum UserStatusEnum {

    ACTIVATE(1, "ACTIVATE", "生效中"),
    LOG_OFF(2, "LOG_OFF", "注销"),
    MUTED(3, "MUTED", "禁言"),
    ;

    private static Map<Integer, UserStatusEnum> typeMap = Arrays
            .stream(UserStatusEnum.values())
            .collect(Collectors.toMap(UserStatusEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static UserStatusEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
